package game.controller.Unit;

/**
 * MilitaryUnit.java  Date Created: Nov 08, 2012
 *
 * Purpose: To store information related to a military unit.
 *
 * Description: This is a for all the specific military units to implement.
 *
 * @author Chrisb
 */
public abstract class MilitaryUnit {

    public int getCost() { return cost; }
    public int getMovement() { return movement; }
    public int getBattleActions() { return battleActions; }
    public int getDefence() { return defence; }
    public int getRange() { return range; }
    public boolean canFire() { return canFire; }
    public boolean canCharge() { return canCharge; }
    public boolean canSkirmish() { return canSkirmish; }
    public boolean canForceMarch() { return canForceMarch; }
    public boolean canCountercharge() { return canCountercharge; }
    public boolean isPlacedOnMap() { return isPlacedOnMap; }
    public int getOwningNation() { return owningNation; }
    public int getType() { return type; }

    public boolean isSkirmishing() { return isSkirmishing; }

    public void resetMovement() { movesRemaining = movement; }
    public void resetBattleActions() { battleActionsRemaining = battleActions; }
    public void useOneMovement() { movesRemaining--; }
    public void useOneBattleAction() { battleActionsRemaining--; }
    public int movesRemaining() { return movesRemaining; }
    public int battleActionsRemaining() { return battleActionsRemaining; }
    public void placeOnMap() { isPlacedOnMap = true; }
    public void setOwningNation(int nation) { owningNation = nation; }

    public static String getUnitName(int type) {
        switch (type) {
            case GENERAL: return "General";
            case ADMIRAL: return "Admiral";
            case INFANTRY: return "Infantry";
            case ELITE_INFANTRY: return "Elite Infantry";
            case CAVALRY: return "Cavalry";
            case HEAVY_CAVALRY: return "Heavy Cavalry";
            case IRREGULAR_CAVALRY: return "Irregular Cavalry";
            case ARTILLERY: return "Artillery";
            case HORSE_ARTILLERY: return "Horse Artillery";
            case MILITIA: return "Militia";
            case NAVAL_SQUADRON: return "Naval Squadron";
        }
        return "UnknownUnit";
    }

    public abstract String toString();

    protected int cost;
    protected int movement;
    protected int battleActions;
    protected int defence;
    protected int range;
    protected boolean canFire;
    protected boolean canCharge;
    protected boolean canSkirmish;
    protected boolean canForceMarch;
    protected boolean canCountercharge;
    protected boolean isPlacedOnMap = false;

    protected int type;
    protected int owningNation;
    protected boolean isSkirmishing;
    protected int movesRemaining;
    protected int battleActionsRemaining;

    public static final int GENERAL = 0;
    public static final int ADMIRAL = 1;
    public static final int INFANTRY = 2;
    public static final int ELITE_INFANTRY = 3;
    public static final int CAVALRY = 4;
    public static final int HEAVY_CAVALRY = 5;
    public static final int IRREGULAR_CAVALRY = 6;
    public static final int ARTILLERY = 7;
    public static final int HORSE_ARTILLERY = 8;
    public static final int MILITIA = 9;
    public static final int NAVAL_SQUADRON = 10;
}
